import concurrent.futures

import execjs
import requests

def download(page):
    jsFile = open('中国土地市场网.js', 'r', encoding='utf-8').read()
    ckeyG = execjs.compile(jsFile).call('hashc')
    headers = {
        "Connection": "keep-alive",
        "Pragma": "no-cache",
        "Cache-Control": "no-cache",
        "Accept": "application/json, text/plain, */*",
        "Hash": ckeyG,
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
        "Content-Type": "application/json",
        "Origin": "https://www.landchina.com",
        "Sec-Fetch-Site": "same-site",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Dest": "empty",
        "Referer": "https://www.landchina.com/",
        "Accept-Language": "zh-CN,zh;q=0.9"
    }
    url = "https://api.landchina.com/tGyjh/plan/list"
    data = {"pageNum":f"{page}","pageSize":"10","startDate":"","endDate":""}
    response = requests.post(url, headers=headers, json=data)

    print(response.text)

if __name__ == '__main__':
    with concurrent.futures.ThreadPoolExecutor(3) as f:
        for page in range(10):
            f.submit(download,page)
